package com.database;

import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;

public class PeopleInformation extends Activity implements java.io.Serializable{
	private String name;
	private String password;
	private int loclismPassCount;
	private int[] passCount = new int[5];
	private int goldNumber;
	private boolean log;
	public boolean isLog() {
		return log;
	}

	public void setLog(boolean log) {
		this.log = log;
	}

	private SharedPreferences peopleInformation;
	private Editor informationEditor;

	public PeopleInformation(String peopleInformation, Context context) {
		this.peopleInformation = context.getSharedPreferences(
				peopleInformation, Context.MODE_WORLD_READABLE);
		this.informationEditor = this.peopleInformation.edit();
	}

	public String getName() {
		this.name = this.peopleInformation.getString("name", "");
		return name;
	}

	public void setName(String name) {
		this.name = name;
		this.informationEditor.putString("name", name);
		this.informationEditor.commit();
	}

	public String getPassword() {
		this.password = this.peopleInformation.getString("password", "");
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
		this.informationEditor.putString("password", password);
		this.informationEditor.commit();
	}

	public int getLoclismPassCount() {
		this.loclismPassCount = this.peopleInformation.getInt(
				"loclismPassCount", 0);
		return loclismPassCount;
	}

	public void setLoclismPassCount(int loclismPassCount) {
		this.loclismPassCount = loclismPassCount;
		this.informationEditor.putInt("loclismPassCount", loclismPassCount);
		this.informationEditor.commit();
	}

	public int getPassCount(int i) {
		this.passCount[i] = this.peopleInformation.getInt("passCount" + i, 0);
		return passCount[i];
	}

	public void setPassCount(int i,int passCount) {
		this.passCount[i] = passCount;
		this.informationEditor.putInt("passCount" + i, passCount);
		this.informationEditor.commit();
	}

	public int getGoldNumber() {
		this.goldNumber = this.peopleInformation.getInt("goldNumber", 100);
		return goldNumber;
	}

	public void setGoldNumber(int goldNumber) {
		this.goldNumber = goldNumber;
		this.informationEditor.putInt("goldNumber", goldNumber);
		this.informationEditor.commit();
	}
}
